Skip to content

style: low-risk lint fixes#1391

Merged
koelzen merged 3 commits into
mainfrom
fix/golint
Jun 24, 2026
Merged

style: low-risk lint fixes#1391
koelzen merged 3 commits into
mainfrom
fix/golint

Conversation

@koelzen

@koelzen koelzen commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Related Issues

  • Fixes #

Type of Change

  • feat New feature
  • fix Bug fix
  • refactor Internal refactor
  • docs Documentation only
  • test Test-only change
  • chore Build, tooling, or maintenance

Validation

  • make test
  • make lint
  • Manual verification completed
  • Not applicable

Validation Notes

Checklist

  • PR title follows Conventional Commits (for example: fix: avoid batch block key collisions)
  • I self-reviewed the diff
  • I updated tests for changed behavior, or explained why tests are not needed
  • I updated docs/comments if user-facing behavior or developer workflow changed
  • I regenerated protobuf / client artifacts if .proto or generated client files changed
  • I called out breaking changes, migrations, or operator impact below

Breaking Changes / Migration Notes

  • None

Additional Context

Summary by CodeRabbit

  • Bug Fixes
    • Improved free-gas account updates with clearer validation and correct record add/remove behavior.
    • Prevented unnecessary/duplicate IBC denom metadata updates for rollapps.
    • Fixed sequencer-related counting and validation, including duplicate-index checks and undelegation when validators are missing.
    • Refined wstaking delegation and fixed-deposit withdrawal control flow.
  • Chores
    • Enhanced linting workflows to support change-based runs (including fix mode, PR boundaries, and full-repo linting), removing the old non-boundary behavior.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ea1630a-663c-4517-a8f5-6c2ee20dbf15

📥 Commits

Reviewing files that changed from the base of the PR and between 4a648b0 and 3c8451f.

📒 Files selected for processing (6)
  • x/kyc/keeper/grpc_query_test.go
  • x/kyc/keeper/msg_server_test.go
  • x/megroup/types/expected_keepers.go
  • x/wdistri/keeper/keeper.go
  • x/wdistri/keeper/keeper_test.go
  • x/wnft/keeper/grpc_query.go
✅ Files skipped from review due to trivial changes (2)
  • x/wdistri/keeper/keeper.go
  • x/kyc/keeper/msg_server_test.go

📝 Walkthrough

Walkthrough

The Makefile adds revision-based lint targets. Several Go files update import aliases, replace fixed-string error creation with errors.New, and adjust keeper, query, and message-server branching.

Changes

Go and Makefile updates

Layer / File(s) Summary
Revision-based lint targets
Makefile
Adds lint_base_rev and lint_pr_base_rev, changes lint to run against a revision boundary, adds lint-fix, lint-pr, and lint-all, and updates .PHONY.
Import and helper wiring
app/modules.go, app/keepers/keys.go, x/megroup/types/expected_keepers.go, x/wdistri/keeper/keeper.go, x/wdistri/keeper/keeper_test.go, x/sequencer/keeper/replace_proposer.go, x/wstaking/client/cli/tx_replace_consensus_pubkey.go, x/wstaking/keeper/msg_server_validator.go, x/wstaking/keeper/update_pub_key.go, x/sequencer/simulation/create_sequencer.go
Adjusts import aliases and keeper type references, rewires related test helpers, normalizes the replace-proposer type alias, and updates the CLI block-number variable and nil-check error handling.
Command and query helper adjustments
cmd/med/cmd/utils.go, app/keepers/wasm_me_msg.go, app/apptesting/test_helpers.go, cmd/med/cmd/genmoduleaccount.go, x/wnft/keeper/grpc_query.go
Changes JSON unmarshalling to txtypes.TxRaw, preallocates slices, captures WriteString return values, adjusts module-account appending, and updates NFT query result construction.
Fixed-string validation errors
cmd/med/cmd/gen_relayer.go, x/delayedack/types/params.go, x/kyc/keeper/did.go, x/kyc/keeper/keeper.go, x/sequencer/keeper/grpc_query_sequencers_by_rollapp.go, x/sequencer/types/genesis.go
Replaces formatted validation errors with errors.New in relayer, delayed-ack, KYC, sequencer query, and genesis validation paths.
Keeper branching and transfer flow
x/dao/keeper/msg_server.go, x/denommetadata/ibc_middleware.go, x/wstaking/keeper/alias_functions.go, x/wstaking/keeper/fixed_deposit_cfg.go, x/wstaking/keeper/kyc_reward.go, x/wstaking/keeper/msg_server.go, x/wstaking/keeper/msg_server_delegate.go, x/wstaking/keeper/msg_server_fixed_deposit.go, x/wstaking/keeper/msg_server_ibc_transfer_from_region_treasure.go, x/wstaking/keeper/msg_server_undelegate.go
Reworks free-gas account handling, membership checks, reward calculations, fixed-deposit counters, KYC reward conditions, message-server keeper storage, delegation and withdrawal branching, IBC transfer invocation, and undelegation validation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The template is present, but the Summary, Validation Notes, and several checklist items are left blank or unchecked. Add a real summary, link related issues, document validation details, and complete the checklist items relevant to this PR.
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the PR’s maintenance lint-fix focus.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/golint

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
x/sequencer/keeper/replace_proposer.go (1)

15-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use idiomatic nil-check ordering and lowercase static error text.

Suggested patch
-	if nil == data {
-		return errors.New("SetReplaceProposer data is nil")
+	if data == nil {
+		return errors.New("set replace proposer data is nil")
 	}

As per path instructions, "**/*.go: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@x/sequencer/keeper/replace_proposer.go` around lines 15 - 16, The nil guard
in replace_proposer.go should follow idiomatic Go style by checking the variable
against nil in the usual order and by using lowercase static error text. Update
the nil check in the SetReplaceProposer path to match Uber Go style conventions,
and adjust the returned error string in the relevant function so it starts with
a lowercase letter while keeping the existing message meaning.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@x/sequencer/keeper/grpc_query_sequencers_by_rollapp.go`:
- Line 5: The gRPC handler in sequencersByRollapp should not return a generic
error; replace the current errors.New("unsupport function") return in the query
handler with a status error using codes.Unimplemented so clients receive the
correct gRPC status. Update the grpc_query_sequencers_by_rollapp.go handler to
use status.Error(codes.Unimplemented, "unsupported function") and ensure the
needed gRPC status/codes imports are present while removing the unused errors
import.

---

Nitpick comments:
In `@x/sequencer/keeper/replace_proposer.go`:
- Around line 15-16: The nil guard in replace_proposer.go should follow
idiomatic Go style by checking the variable against nil in the usual order and
by using lowercase static error text. Update the nil check in the
SetReplaceProposer path to match Uber Go style conventions, and adjust the
returned error string in the relevant function so it starts with a lowercase
letter while keeping the existing message meaning.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: fbd3432b-97ca-45d3-938e-48977c2046c7

📥 Commits

Reviewing files that changed from the base of the PR and between b0b6589 and 5b800fc.

📒 Files selected for processing (13)
  • Makefile
  • app/modules.go
  • cmd/med/cmd/gen_relayer.go
  • cmd/med/cmd/utils.go
  • x/dao/keeper/msg_server.go
  • x/delayedack/types/params.go
  • x/denommetadata/ibc_middleware.go
  • x/kyc/keeper/did.go
  • x/kyc/keeper/keeper.go
  • x/sequencer/keeper/grpc_query_sequencers_by_rollapp.go
  • x/sequencer/keeper/replace_proposer.go
  • x/sequencer/simulation/create_sequencer.go
  • x/sequencer/types/genesis.go


import (
"context"
"errors"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
sed -n '1,140p' x/sequencer/keeper/grpc_query_sequencers_by_rollapp.go
rg -n 'UnConfirmSequencerAddressByRollappByStatus|errors\.New\("unsupport function"\)|status\.Error|codes\.Unimplemented' x/sequencer/keeper/grpc_query_sequencers_by_rollapp.go

Repository: openmetaearth/me-hub

Length of output: 5008


Return codes.Unimplemented from this handler. errors.New("unsupport function") is a generic error and will surface to clients as Unknown; use status.Error(codes.Unimplemented, "unsupported function") instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@x/sequencer/keeper/grpc_query_sequencers_by_rollapp.go` at line 5, The gRPC
handler in sequencersByRollapp should not return a generic error; replace the
current errors.New("unsupport function") return in the query handler with a
status error using codes.Unimplemented so clients receive the correct gRPC
status. Update the grpc_query_sequencers_by_rollapp.go handler to use
status.Error(codes.Unimplemented, "unsupported function") and ensure the needed
gRPC status/codes imports are present while removing the unused errors import.

Source: Path instructions

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@x/wstaking/keeper/msg_server_delegate.go`:
- Around line 70-75: The reward payout check in msg_server_delegate.go is using
a post-subtraction balance, which can wrongly reject valid payouts. Update the
logic in the delegate reward handling flow around region.DelegateInterest so the
insufficient-funds validation happens before subtracting rewards, and only
subtract after that check passes; use the existing region.DelegateInterest,
rewards, and the surrounding delegate payout code path to locate it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro Plus

Run ID: f3f25473-36a1-48ee-a9bc-908c3e670e92

📥 Commits

Reviewing files that changed from the base of the PR and between 5b800fc and 4a648b0.

📒 Files selected for processing (15)
  • app/apptesting/test_helpers.go
  • app/keepers/keys.go
  • app/keepers/wasm_me_msg.go
  • cmd/med/cmd/genmoduleaccount.go
  • x/wstaking/client/cli/tx_replace_consensus_pubkey.go
  • x/wstaking/keeper/alias_functions.go
  • x/wstaking/keeper/fixed_deposit_cfg.go
  • x/wstaking/keeper/kyc_reward.go
  • x/wstaking/keeper/msg_server.go
  • x/wstaking/keeper/msg_server_delegate.go
  • x/wstaking/keeper/msg_server_fixed_deposit.go
  • x/wstaking/keeper/msg_server_ibc_transfer_from_region_treasure.go
  • x/wstaking/keeper/msg_server_undelegate.go
  • x/wstaking/keeper/msg_server_validator.go
  • x/wstaking/keeper/update_pub_key.go
💤 Files with no reviewable changes (1)
  • cmd/med/cmd/genmoduleaccount.go
✅ Files skipped from review due to trivial changes (6)
  • x/wstaking/client/cli/tx_replace_consensus_pubkey.go
  • app/keepers/wasm_me_msg.go
  • x/wstaking/keeper/msg_server_validator.go
  • x/wstaking/keeper/update_pub_key.go
  • app/keepers/keys.go
  • app/apptesting/test_helpers.go

Comment on lines 70 to 75
if region.DelegateInterest.GTE(rewards) {
region.DelegateInterest = region.DelegateInterest.Sub(rewards)
} else {
}
if !region.DelegateInterest.GTE(rewards) {
return nil, fmt.Errorf("region(%s) total interest not enough.need pay %s,only have %s",
region.RegionId, rewards.String(), region.DelegateInterest.String())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Post-subtraction check rejects valid reward payouts.

Line 73 re-checks region.DelegateInterest >= rewards after subtracting rewards, so any balance between rewards and 2*rewards now fails even though it was sufficient before the deduction. Keep the insufficiency test on the pre-subtraction balance.

🐛 Proposed fix
-		if region.DelegateInterest.GTE(rewards) {
-			region.DelegateInterest = region.DelegateInterest.Sub(rewards)
-		}
-		if !region.DelegateInterest.GTE(rewards) {
+		if !region.DelegateInterest.GTE(rewards) {
 			return nil, fmt.Errorf("region(%s) total interest not enough.need pay %s,only have %s",
 				region.RegionId, rewards.String(), region.DelegateInterest.String())
 		}
+		region.DelegateInterest = region.DelegateInterest.Sub(rewards)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if region.DelegateInterest.GTE(rewards) {
region.DelegateInterest = region.DelegateInterest.Sub(rewards)
} else {
}
if !region.DelegateInterest.GTE(rewards) {
return nil, fmt.Errorf("region(%s) total interest not enough.need pay %s,only have %s",
region.RegionId, rewards.String(), region.DelegateInterest.String())
if !region.DelegateInterest.GTE(rewards) {
return nil, fmt.Errorf("region(%s) total interest not enough.need pay %s,only have %s",
region.RegionId, rewards.String(), region.DelegateInterest.String())
}
region.DelegateInterest = region.DelegateInterest.Sub(rewards)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@x/wstaking/keeper/msg_server_delegate.go` around lines 70 - 75, The reward
payout check in msg_server_delegate.go is using a post-subtraction balance,
which can wrongly reject valid payouts. Update the logic in the delegate reward
handling flow around region.DelegateInterest so the insufficient-funds
validation happens before subtracting rewards, and only subtract after that
check passes; use the existing region.DelegateInterest, rewards, and the
surrounding delegate payout code path to locate it.

@koelzen koelzen merged commit f23bcf8 into main Jun 24, 2026
7 checks passed
@koelzen koelzen deleted the fix/golint branch June 24, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant